package br.com.ufpr.util.base;

import org.apache.wicket.Component;
import org.apache.wicket.behavior.Behavior;

import br.com.ufpr.sgp.util.session.CustomSession;

public class DesenvolvedorOnly extends Behavior {
    private static final long serialVersionUID = 4437072130111869305L;

    private boolean isVisible() {
        return CustomSession.get().getUsuario().isAdmin();
    }

    @Override
    public void bind(Component component) {
        final boolean visible = isVisible();
        component.setVisibilityAllowed(visible);
        component.setVisible(visible);
    }

}